<?php
class Wordpress {

    private $ID;

    public function getByID($ID) {
        $list = array();
        $sql = "SELECT * FROM caws_wordpress
                WHERE ID = '" . $ID . "' ";

        $result = mysql_query($sql);
        $i = 0;
        while($rows = mysql_fetch_array($result)) {
            $list[$i]['ID'] = $rows['ID'];
            $list[$i]['wp_username'] = $rows['wp_username'];
            $list[$i]['wp_password'] = $rows['wp_password'];
            $list[$i]['wp_url'] = $rows['wp_url'];
            $list[$i]['wp_name'] = $rows['wp_name'];
            $list[$i]['wp_template'] = $rows['wp_template'];
            $i++;
        }
        return $list;
    }

    public function getByObj(Wordpress $w) {
        $list = array();
        $sql = 'SELECT * FROM caws_wordpress';
        $result = mysql_query($sql);
        $i = 0;
        while($rows = mysql_fetch_array($result)) {
            $list[$i]['ID'] = $rows['ID'];
            $list[$i]['wp_username'] = $rows['wp_username'];
            $list[$i]['wp_password'] = $rows['wp_password'];
            $list[$i]['wp_url'] = $rows['wp_url'];
            $list[$i]['wp_name'] = $rows['wp_name'];
            $list[$i]['wp_template'] = $rows['wp_template'];
            $i++;
        }
        return $list;
    }

    public function setID($ID) {
        $this->ID = $ID;
    }

    public function getID() {
        return $this->ID;
    }
}
?>
